****************************************************************
****************************************************************
*REPLICATION FILE **********************************************
*"Buying Evidence: Policy Research as a Presidential Commodity"*
*Journal of Politics *******************************************
*Rachel Augustine Potter ***************************************
*rapotter@virginia.edu *****************************************
*December 2023 **************************************************
****************************************************************
****************************************************************

**This .do file replicates the analyes in the paper and the Appendix 

*Before beginning, change the working directory to your local directory & run the file "compiling.do"


xtset Agency


************************************************
****************MAIN PAPER  RESULTS*************
************************************************

***Table 1
xtreg lnamount  subtopic_anymention  clinton obama bushii if amount > 1000 & restricted ==1 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention   clinton obama bushii if amount > 1000 & firstyear == 1 & restricted ==1 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 & firstyear == 1  , fe cluster(Agency) robust 


***Spending Particularlism extension - alternative explanation
*Table SI-8
xtreg lnamount i.subtopic_anymention  i.corestate##i.electionyear i.swingstate##i.electionyear inhousecapacity budgetauth_pc contractp100 i.study_type   clinton obama bushii   if amount > 1000 , fe cluster(Agency) robust 
eststo p1 

xtreg lnamount i.subtopic_anymention  i.corestate##i.electionyear i.swingstate##i.electionyear inhousecapacity budgetauth_pc contractp10 i.study_type   clinton obama bushii   if amount > 1000 & firstyear ==1, fe cluster(Agency) robust 
eststo p2

*Figure 2
coefplot p1 (p2, msymbol(D)), drop(1.electionyear contractp100 inhousecapacity budgetauth_pc inhousecapacity contractp10 *.study_type  clinton bushii obama _cons) xline(0) graphregion(color(white))  aseq legend( pos(7) bplacement(sw) label(2 "All contracts") label(4 "New contracts") cols(1) nobox region(lcolor(white))) xtitle("Research $ (ln)") xline(0, lcolor(black))


***Congressional requests - alternative extension
*Table SI-10
xtreg lnamount i.subtopic_anymention  lnhearings lnlawslast12  inhousecapacity budgetauth_pc contractp100  i.study_type   clinton obama bushii   if amount > 1000 , fe cluster(Agency) robust 
eststo c1

xtreg lnamount i.subtopic_anymention  lnhearings lnlawslast12  inhousecapacity budgetauth_pc contractp100  i.study_type   clinton obama bushii   if amount > 1000 & samenow ==1, fe cluster(Agency) robust 
eststo c2

*Figure 3
coefplot c1 (c2, msymbol(D)) , drop(1.electionyear inhousecapacity budgetauth_pc contractp100 *.study_type budget_growth clinton bushii obama _cons) xline(0) graphregion(color(white))  aseq legend( pos(7) bplacement(sw) label(2 "All contracts") label(4 "New contracts") cols(1) nobox region(lcolor(white))) xtitle("Research $ (ln)") xline(0, lcolor(black)) name(congpressure, replace)


***Table 2: Discontinuation of Research Contracts
xtreg takeback i.newadmin  clinton obama bushii if  maxmod == modnumber & restricted2 ==1 , fe cluster(Agency) robust

xtreg takeback i.newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if maxmod == modnumber , fe cluster(Agency) robust

xtreg proportion i.newadmin clinton obama bushii if maxmod == modnumber & restricted2 ==1   , fe cluster(Agency) robust

xtreg proportion i.newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if  maxmod == modnumber , fe cluster(Agency) robust


************************************************
********SUPPORTING INFORMATION RESULTS**********
************************************************
*B-1 Table of descriptive statistics 


*Figure SI-1 
set scheme s2mono, 
twoway kdensity pos_obligation if  bushii ==1   & pos_obligation < 100000 ||  kdensity pos_obligation if   obama ==1    & pos_obligation < 100000||   kdensity pos_obligation if  trump ==1    & pos_obligation < 100000 , graphregion(color(white)) ylab(none, nogrid) ytitle("") xtitle("") title("")   xlab(0 "0"  50000 "$50k" 100000 "$100k"  ) legend(label(1 "Bush") label(2 "Obama") label(3 "Trump") row(1) col(3)) name(adminkern, replace)


***Table SI-3: Presidential Prioritization & Size of Research Contract Awards, Including DOD and Other Agencies
xtreg lnamount  i.subtopic_anymention  clinton obama bushii if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  i.subtopic_anymention clinton obama bushii if amount > 1000 & firstyear == 1 , fe cluster(Agency) robust 

xtreg takeback i.newadmin  clinton obama bushii if  maxmod == modnumber , fe cluster(Agency) robust

xtreg proportion i.newadmin clinton obama bushii if maxmod == modnumber  , fe cluster(Agency) robust


***Table SI-4: Presidential Prioritization & Size of Research Contract Awards, with Administration Time Trends
xtreg lnamount  subtopic_anymention  i.admin_counter if amount > 1000 & inhousecapacity !=.  , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity  budgetauth_pc contractp100 i.study_type  i.admin_counter if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention  i.admin_counter if amount > 1000 & firstyear == 1 & inhousecapacity !=. , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity budgetauth_pc contractp100 i.study_type  i.admin_counter if amount > 1000 & firstyear == 1  , fe cluster(Agency) robust 


***Table SI-5: Spending w/o fixed effects and w/ year fixed effects 
xtreg lnamount  subtopic_anymention inhousecapacity  budgetauth_pc contractp100 i.study_type  if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity  budgetauth_pc contractp100 i.study_type  i.year if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity budgetauth_pc contractp100 i.study_type  if amount > 1000 & firstyear == 1  , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention inhousecapacity budgetauth_pc contractp100 i.study_type  i.year if amount > 1000 & firstyear == 1  , fe cluster(Agency) robust 


***Table SI-6: Presidential Agenda & Size of Research Contract Awards (Alternate Coding)
xtreg lnamount  subtopic_aboveavg  clinton obama bushii if amount > 1000 & restricted ==1 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_aboveavg inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_aboveavg inhousecapacity budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 & firstyear == 1 & restricted ==1 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_aboveavg inhousecapacity budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 & firstyear == 1  , fe cluster(Agency) robust 


**Table SI-7: Divided government control
xtreg lnamount  subtopic_anymention divided inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount  subtopic_anymention divided inhousecapacity budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 & firstyear == 1  , fe cluster(Agency) robust 

xtreg takeback i.newadmin divided  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if maxmod == modnumber , fe cluster(Agency) robust

xtreg proportion i.newadmin divided  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if  maxmod == modnumber , fe cluster(Agency) robust


*Figure SI-3: "Departmental Leave-One-Out Analysis"
gen OPMdept2 = OPMdept
replace OPMdept2 = "" if restricted !=1 & amount <= 1000

levelsof OPMdept2, local(depts)
foreach y of local depts{
xtreg lnamount  i.subtopic_anymention inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 & OPMdept2 !="`y'", fe cluster(Agency) robust 

eststo LOdept`y', title(`y')
}

levelsof OPMdept2, local(depts)
coefplot (LOdeptAG, aseq("1")) (LOdeptAH, aseq("2")) (LOdeptAN, aseq("3")) (LOdeptAU, aseq("4")) (LOdeptBD, aseq("5")) (LOdeptBF, aseq("6")) (LOdeptBG, aseq("7")) (LOdeptBT, aseq("8")) (LOdeptCM, aseq("9")) (LOdeptCT, aseq("10")) LOdeptCT LOdeptDJ LOdeptDL LOdeptDN LOdeptEB LOdeptED LOdeptEE LOdeptEM LOdeptEP LOdeptEW LOdeptFC LOdeptFL LOdeptFQ LOdeptFT LOdeptFW LOdeptFY LOdeptGQ LOdeptGS LOdeptHE LOdeptHS LOdeptIB LOdeptIN LOdeptKS LOdeptLF LOdeptMC LOdeptMI LOdeptNF LOdeptNL LOdeptNP LOdeptNQ LOdeptNU LOdeptOM LOdeptPU LOdeptRH LOdeptRR LOdeptRS LOdeptSB LOdeptSE LOdeptSK LOdeptSM LOdeptST LOdeptSZ LOdeptTB LOdeptTC LOdeptTD LOdeptTR LOdeptVA, vertical drop(inhousecapacity budgetauth_pc contractp100 *.study_type budget_growth clinton bushii obama _cons) xline(0) graphregion(color(white))  aseq swapnames  ytitle("Research $ (ln)") yline(0, lcolor(black)) xtitle("Presidential Agenda Coefficient") ylab(0 (.05) .25,nogrid) legend(off)  yscale(range (0, .25)) xlab(1 "AG" 2 "AH" 3 "AN" 4 "AU" 5 "BD" 6 "BF" 7 "BG" 8 "BT" 9 "CM" 10 "CT" 11 "DJ" 12 "DL" 13 "DN" 14 "EB" 15 "ED" 16 "EE" 17 "EM" 18 "EP" 19 "EW" 20 "FC" 21 "FL" 22 "FQ" 23 "FT" 24 "FW" 25 "FY" 26 "GQ" 27 "GS" 28 "HE" 29 "HS" 30 "IB" 31 "IN" 32 "KS" 33 "LF" 34 "MC" 35 "MI" 36 "NF" 37  "NL" 38 "NP" 39 "NQ" 40 "NU" 41 "OM" 42 "PU" 43 "RH" 44 "RR" 45 "RS" 46 "SB" 47 "SE" 48 "SK" 49 "SM" 50 "ST" 51 "SZ" 52 "TB" 53 "TC" 54 "TD" 55 "TR" 56 "VA" , angle(vertical) labsize(vsmall)) name(leaveout, replace)


**Table SI-8:Particularism table
*see above


**Table SI-9: Huber-Dynes table
xtreg lnamount i.subtopic_anymention i.rpres##c.RtendenencyPRES inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 , fe cluster(Agency) robust 

xtreg lnamount i.subtopic_anymention i.rpres##c.RtendenencyPRES inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii if amount > 1000 & firstyear==1 , fe cluster(Agency) robust 


***Table SI-10:Congressional pressure table
*see above


***Table SI-11: Deobligation of Research Contracts, Alternate Estimation Strategies
logit takeback newadmin  clinton obama bushii i.Agency if  maxmod == modnumber & restricted2 ==1, cluster(Agency) robust

logit  takeback newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii i.Agency if maxmod == modnumber , cluster(Agency) robust

fracreg logit proportion  newadmin clinton obama bushii i.Agency if maxmod == modnumber & restricted2 ==1  , vce(cluster Agency)

fracreg logit proportion newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  clinton obama bushii i.Agency if  maxmod == modnumber ,  vce(cluster Agency)


**Table SI-12: Deobligation w/o admin fixed effects and w/ year fixed effects 
xtreg takeback i.newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type   if maxmod == modnumber , fe cluster(Agency) robust

xtreg takeback i.newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  i.year if maxmod == modnumber , fe cluster(Agency) robust

xtreg proportion i.newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type   if  maxmod == modnumber , fe cluster(Agency) robust

xtreg proportion i.newadmin  lnawardtotal inhousecapacity  budgetauth_pc contractp100 i.study_type  i.year if  maxmod == modnumber , fe cluster(Agency) robust
